<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>编辑用户 - 威客任务平台</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="/">威客任务平台</a>
            <div class="navbar-nav ms-auto">
                <a class="nav-link" th:href="@{/dashboard}">仪表板</a>
                <a class="nav-link" th:href="@{/admin/users}">用户管理</a>
                <a class="nav-link" th:href="@{/logout}">退出</a>
            </div>
        </div>
    </nav>

    <div class="container mt-4">
        <h2>编辑用户</h2>
        
        <div class="card">
            <div class="card-body">
                <form th:action="@{/admin/users/update/{id}(id=${user.userId})}" th:object="${user}" method="post">
                    <input type="hidden" th:field="*{userId}" />
                    
                    <div class="mb-3">
                        <label for="username" class="form-label">用户名</label>
                        <input type="text" class="form-control" id="username" th:field="*{username}" readonly>
                    </div>
                    
                    <div class="mb-3">
                        <label for="email" class="form-label">邮箱</label>
                        <input type="email" class="form-control" id="email" th:field="*{email}" required>
                    </div>
                    
                    <div class="mb-3">
                        <label for="phone" class="form-label">手机号</label>
                        <input type="text" class="form-control" id="phone" th:field="*{phone}">
                    </div>
                    
                    <div class="mb-3">
                        <label for="role" class="form-label">角色</label>
                        <select class="form-control" id="role" th:field="*{role}" required>
                            <option value="admin">管理员</option>
                            <option value="employer">雇主</option>
                            <option value="freelancer">威客</option>
                        </select>
                    </div>
                    
                    <button type="submit" class="btn btn-primary">更新用户</button>
                    <a th:href="@{/admin/users}" class="btn btn-secondary">取消</a>
                </form>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>